﻿
Partial Class pages_datas_usercontrols_UCDataColumn
    Inherits System.Web.UI.UserControl

    Public Sub Display(ByVal column As EData, ByVal d As CData)
        lit.Text = d.GetString(column)
        Select Case column
            Case EData.Outlook
                Select Case d.Outlook
                    Case EOutlook.Long : lit.ForeColor = Drawing.Color.Blue
                    Case EOutlook.Short : lit.ForeColor = Drawing.Color.Green
                    Case EOutlook.Stop : lit.ForeColor = Drawing.Color.Red
                    Case EOutlook.Neutral : lit.Text = String.Empty
                End Select
            Case EData.Long, EData.LongQty
                If d.GetData(column) > 0 Then lit.ForeColor = Drawing.Color.Blue Else lit.Text = String.Empty
            Case EData.Short, EData.ShortQty
                If d.GetData(column) > 0 Then lit.ForeColor = Drawing.Color.Green Else lit.Text = String.Empty
            Case EData.Returns, EData.Total
                If d.Returns < 0 Then lit.ForeColor = Drawing.Color.Red
                If Not IsNothing(d.Prev) AndAlso d.SimulatedTotal = d.Prev.SimulatedTotal Then lit.Text = String.Empty
            Case EData.Held
                If Not IsNothing(d.Prev) AndAlso d.SimulatedHeld = d.Prev.SimulatedHeld Then lit.Text = String.Empty
            Case EData.ExpAdjRet
                If d.ExpAdjRet < 0 Then lit.ForeColor = Drawing.Color.Red
            Case EData.PlusDM
                If d.PlusDM = 0 Then lit.Text = String.Empty Else lit.ForeColor = Drawing.Color.Blue
            Case EData.MinusDM
                If d.MinusDM = 0 Then lit.Text = String.Empty Else lit.ForeColor = Drawing.Color.Green
            Case EData.PointValue
                If d.SimulatedPointValue = 0 Then lit.Text = String.Empty
            Case EData.Notes
                lit.Style.Add("float", "left")
                lit.Style.Add("text-align", "left")
            Case EData.Open
                If Not IsNothing(d.Prev) AndAlso (d.Prev.Outlook = EOutlook.Long Or d.Prev.Outlook = EOutlook.Short) Then lit.Font.Bold = True
            Case EData.StopLong
                If Not IsNothing(d.Next) AndAlso d.Next.Notes.LongWasStopped Then lit.Font.Bold = True
            Case EData.StopShort
                If Not IsNothing(d.Next) AndAlso d.Next.Notes.ShortWasStopped Then lit.Font.Bold = True
            Case EData.Exposure
                If d.Exposure = 0 Then lit.Text = String.Empty
        End Select
    End Sub
    Public Sub Display(ByVal column As EDecision, ByVal d As CData)
        chk.Visible = True
        chk.ToolTip = String.Concat(column, "=", d.GetString(column))
        chk.Checked = d.GetDecision(column)
    End Sub

End Class
